package cn.iocoder.yudao.module.system.dal.mysql.tenant;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.order.TenantOrderPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantOrderDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 租户订单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TenantOrderMapper extends BaseMapperX<TenantOrderDO> {

    default PageResult<TenantOrderDO> selectPage(TenantOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantOrderDO>()
                .eqIfPresent(TenantOrderDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(TenantOrderDO::getPayStatus, reqVO.getPayStatus())
                .eqIfPresent(TenantOrderDO::getDeliveryStatus, reqVO.getDeliveryStatus())
                .eqIfPresent(TenantOrderDO::getDeliveryNo, reqVO.getDeliveryNo())
                .eqIfPresent(TenantOrderDO::getOwnerUserId, reqVO.getOwnerUserId())
                .betweenIfPresent(TenantOrderDO::getPayTime, reqVO.getPayTime())
                .betweenIfPresent(TenantOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantOrderDO::getId));
    }

}
